using System.ServiceModel;
using TimeLineDataContract;

namespace TimeLineControlNamedPipes.Communication
{

    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
    public class PipeService : IPipeService
    {
        public static string UriControl = "net.pipe://localhost/TimeLineControl";
        public static string UriPowerPoint = "net.pipe://localhost/TimeLinePowerPoint";

        #region IPipeService Members

        public void PipeSendSlidesDeck(SlideDeskContract[] data)
        {
            if (DataSlidesReady != null)
                DataSlidesReady(data);
        }

        public void PipeSendCurrentSlide(SlideDeskContract data)
        {
            if (SlideChangeReady != null)
                SlideChangeReady(data);
        }

        public void PipeSendNameApp(string data)
        {
            if (DataAppReady != null)
                DataAppReady(data);
        }

        public void PipeSendOk()
        {
            if (DataPipeReady != null)
                DataPipeReady();
        }

        public void PipeShowbar(bool show)
        {
            if (DataPipeShowBar != null)
                DataPipeShowBar(show);
        }

        public void PipeSlideRunning(bool running)
        {
            if (DataSlideRunning != null)
                DataSlideRunning(running);
        }

        public delegate void DataPipeSlideRunning(bool running);
        public DataPipeSlideRunning DataSlideRunning;

        public delegate void DataPipeShowBarReady(bool show);
        public DataPipeShowBarReady DataPipeShowBar;

        public delegate void DataPipeIsReady();
        public DataPipeIsReady DataPipeReady;

        public delegate void DataNameAppIsReady(string hotData);
        public DataNameAppIsReady DataAppReady;

        public delegate void DataIsReady(SlideDeskContract[] hotData);
        public DataIsReady DataSlidesReady;

        public delegate void DataCurrentIsReady(SlideDeskContract hotData);
        public DataCurrentIsReady SlideChangeReady;

        #endregion
    }
}
